/**
 * All right reserved@Raygo 2022~2030
 */
package com.raygo.jfxdemo.view;

import javafx.scene.Scene;
import javafx.scene.control.Pagination;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.stage.Stage;

/**
 * 分页示例
 *
 * @author Raygo
 * @since 2022年3月5日
 */
public class PaginationUI {
    /**
     * 打开窗口
     *
     * @throws Exception 异常
     */
    public void show() {
        Stage stage = new Stage();

        // 分页控件
        Pagination pagination = new Pagination(5, 0);
        pagination.setPageFactory(pageIndex -> new Text("这是第" + String.valueOf(pageIndex) + "页"));

        VBox vbox = new VBox(pagination);
        Scene scene = new Scene(vbox);
        stage.setScene(scene);
        stage.setWidth(640.0d);
        stage.setHeight(480.0d);
        stage.setTitle("分页");
        stage.show();
    }
}
